/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SnpDbHndInterfaces;

import SnpDbEntities.User;
import java.rmi.RemoteException;
import java.util.LinkedHashMap;

/**
 * This interface provides methods manipulating data in database
 * (if logged user have sufficient permissions).
 * @author Łukasz 'byku' Guzik
 */
public interface DBUsrHandling extends java.rmi.Remote
{
    /**
     * Reads user data from database
     * @param iID user with that ID will be returned
     * @return User filled with corresponding data or null in case of failure
     * @throws RemoteException
     */
    User getUser(int iID) throws RemoteException;

    /**
     * Reads user data from database
     * @param strLogin user with that login will be returned
     * @return User filled with corresponding data or null in case of failure
     * @throws RemoteException
     */
    User getUser(String strLogin) throws RemoteException;

    /**
     * Reads all user data from database
     * @return LinkedHashMap<Integer, User> filled with <UserID, User> pairs or null if failed
     * @throws RemoteException
     */
    LinkedHashMap<Integer, User> getUsersList() throws RemoteException;

    /**
     * Add new User to database
     * @param newUser data which will be added to database
     * @return new user ID or -1 in case of error
     * @throws RemoteException
     */
    int addUser(User newUser) throws RemoteException;

    /**
     * Updates user data in database
     * @param updated new user's data. ID field indicats which user to update
     * @return true - success, false - failure
     * @throws RemoteException
     */
    boolean updateUser(User updated) throws RemoteException;

    /**
     * Deletes user from database
     * @param deleteID ID of user to be deleted
     * @return true - success, false - failure
     * @throws RemoteException
     */
    boolean deleteUser(int deleteID) throws RemoteException;

    /**
     * Grants user's right to login
     * @param iID ID of user to enable
     * @return true - success, false - failure
     * @throws RemoteException
     */
    boolean enableUser(int iID) throws RemoteException;

    /**
     * Revokes user's right to login
     * @param iID ID of user to disable
     * @return true - success, false - failure
     * @throws RemoteException
     */
    boolean disableUser(int iID) throws RemoteException;
}
